import Sequelize from "sequelize";

// 连接MySQL数据库并导出
export const sequelize = new Sequelize('book', 'root', '123456', {
    host: 'localhost',
    dialect: 'mysql',
    logging: false, // 如果你不希望Sequelize在控制台打印SQL语句，可以设置为false
});
//测试连接
sequelize.authenticate()
.then(()=>{
    console.log('数据库连接成功！');
    
}).catch(err => {
    console.log('数据库连接失败：',err);
    
});

